$(function() {
    //页面初始化设置
    // FastClick.attach(document.body);
    //隐藏顶栏
    hideFix('.am-header');
    var option = {
        URL: pageData.URL,
        val: {
            plate_number: '[name="plate_number"]',
            mobile: '[name="mobile"]',
            code: '[name="code"]',
            password: '[name="password"]',
            password2: '[name="password2"]',
        },
        _xsrf: '[name="_csrf-front"]',
        captcha: false
    };

    simpleForm('#J_RegisterForm', option, '#J_RegisterBtn',
        function(status) {
            //onSubmit
            if(!status) {
                toast($('.form-error:first-child').data('validation-message'));
            }
        },
        function() {
            //onValid
        },
        function(group, msg) {
            //onInValid
        },
        function(res) {
            void 0
            if(res.ret === true) {
                window.location.href = res.url;
            } else {
                toast(res.msg);
            }
        }
    );

    clearForm('[name="mobile"]');
    clearForm('[name="password"]');
    clearForm('[name="confirm_password"]');
});
